Repository navigation
Conversation
A cut at start-up (--resolve-fork, --set-bc-top) now removes the block
hashes and every quick-start checkpoint above the new top, the .prev
backups included. The shutdown checkpoint qs/0 was saved at the old head:
the first start after a cut loaded it, found its blocks gone, set it
aside and exited 255; only the second start worked.
While FORK HELD with only an upper bound of the fork point, the node now
looks for the last common block itself (cs::forkguard::ForkLocator): it
asks the peer of the refused block for a few of its blocks at or below the
bound with the usual BlockRequest, compares their hashes with its own and
narrows down, one request every 6 s at most, down to 20 x max_auto_rollback
blocks (1,000 to 10,000). The answer goes into fork-held.json
("fork_point_status": "exact", or "deeper" beyond the bound), so that
--resolve-fork cuts at the exact point in one run. Read-only: nothing is
stored, unwound or approved; the peer's blocks only locate the point and
must hold together (matches below differences, consecutive blocks chained).
A located point approves no branch; the cut still checks the stored hash
there. A deeper fork makes --resolve-fork remove nothing.
The checkpoint-ahead scenario puts the removed checkpoints back after its
cut, so that it still tests setting them aside.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The search for the last common block uses a peer's answers, which could
be wrong. The point it finds now becomes the fork point ("exact") only if
the peer's block right after it verifies as a synced block would after
our block there: built on it, its signatures against its confidants, and
round confirmations by a majority of the confidants of our block at the
point (BlockChain::verifiesAfterOurBlock). A bootstrap block never
verifies.
Otherwise the point is a hint ("located (unverified)"; "deeper" is a hint
too): fork_point stays the upper bound and --resolve-fork still cuts
there; it cuts at the hint only with --resolve-fork --to-located (Docker:
resolve-fork to-located). Before cutting, --resolve-fork prints our head,
the bound, the located point, its verification status, the cut and the
number of blocks it removes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the official-partition-restart-resolve run every search stopped on block 0: the official peer's genesis block did not match ours, which read as a fork below block 474 that matched. Both chains share the genesis block by definition; the search starts at block 1 at the lowest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB
added a commit
that referenced
this pull request
Nov 21, 2026
…nt, one cut only Before --resolve-fork, wait (RESOLVE_LOCATE_WAIT, 6 min) until every node holding the fork reports "fork_point_status" in fork-held.json; an unverified located point is cut with --to-located. The run fails when a cut lands on an upper bound or a start right after the cut stops with an error. Needs the fork locator of #192 on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB
added a commit
that referenced
this pull request
Nov 21, 2026
Option A after a partition (FORK HELD, the operator follows the official chain with the located fork point of #192, --to-located for an unverified one, --set-bc-top otherwise, or keeps the community chain with dismiss-fork); why the option stays out of the set-up; the gate for H_activate_decentralization of BK's plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A cut (--resolve-fork, --set-bc-top) on a storage that does not start at block 0 (pruned, or a backfill in progress) is refused, removing nothing (Storage::TruncateNoCheckpoint, exit 3), when no quick-start checkpoint is left at or below the new top: such a node cannot slow-start. Checkpoints above the top are set aside as <name>.bad instead of being deleted. - The block hashes are removed above the top through the last block stored before the cut (Storage::truncated_last), across gaps. - The fork point search takes a reply only if it holds no more blocks than asked for, each of a different height asked for; each block is verified once at most, and only one that is not ours. A reply from the searched peer that is not for the search is dropped when nothing else waits for one. - A pruned peer (NoSuchBlocks) raises the search floor past the lowest height asked for instead of counting a failed attempt, a limited number of times. - Docs: a verified point may lie lower than the refused branch's own fork; the cut then removes more blocks than needed (a resync). Tests: a pruned cut below every checkpoint, the --to-located cut of a changed block (TruncateMismatch), the hash removal across a gap, duplicated reply blocks, a pruned peer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two follow-ups to the FORK HELD handling of #189. Both are local to the node: block content, validation and what the node accepts are unchanged.
1. Clean first start after a cut. After
--resolve-forkor--set-bc-top, the first start stopped with exit code 255: the shutdown checkpointqs/0had been saved at the old head, the node loaded it, found that its blocks were no longer on disk, set it aside and exited; only the second start worked. A successful cut now also removes:caches/hashdb,seqdb). Before, a checkpoint above the top still looked like part of this chain..prevbackup. Aqs/0withouthead.bingoes as well, because it cannot be placed.The next start then quick-starts from the highest checkpoint at or below the top, or reads the chain from the start.
Review fixes:
qs/<n>.bad, not deleted.TruncateNoCheckpoint, exit 3, nothing removed). Such a node cannot slow-start.trimToFloor). Thecheckpoint-aheadrobustness scenario now checks that the cut removed the checkpoints. It then puts them back, as a restored backup would, so it still tests setting them aside.2. The node finds the exact fork point. After a long partition the node knew only an upper bound of the fork point ("block #930 or lower" for a fork at #533). Each
--resolve-forkcut one block, and the operator had to find the last common block by hand. While FORK HELD the node now asks the peer of the refused block for a few of its blocks at or below the bound, using the usualBlockRequest. It compares their hashes with its own and narrows down to the last block both chains share (cs::forkguard::ForkLocator). The answer goes intofork-held.json("fork_point_status": "exact", with the original upper bound and the peer) and into the detail line, so--resolve-forkcuts there in one run."exact") only if the peer's block right after it verifies as a synced block would after this node's block there (BlockChain::verifiesAfterOurBlock): it must be built on that block, its signatures must verify, and a majority of the confidants of this node's block must have signed its round confirmations. A bootstrap block never verifies."located (unverified)", or"deeper"when the peer's block differs already at the lowest block searched.--resolve-forkthen still cuts at the upper bound. It cuts at the hint only when the operator adds--to-located(Docker:resolve-fork to-located). Before it removes anything,--resolve-forkprints the node's head, the upper bound, the located point and its verification status, where it cuts and how many blocks that removes.NoSuchBlocksraises the search floor past the lowest height asked for, a limited number of times. Duplicate-request refusals are retried, which can stretch the search to a few minutes on a busy peer.max_auto_rollbackblocks below the bound (1,000 to 10,000; 2,000 when it is 0). It never goes below the first stored block, and never asks for block 0, which both chains share (the official peer's genesis block hashes differently).TruncateMismatch). A located point approves no branch:resolve-approved.jsonis written only for an exact point named by the refused block itself, as before.Docs:
docs/quick-start.md("If your node reports FORK HELD"),docs/differences.md,packaging/docker/README.md.Tests:
tests/csnode/forklocator_tests.cpp) cover:--to-located;BlockChain.LocatedForkPointNeedsAVerifiedNextBlock);--resolve-forkplan for exact and deeper points;BlockChaintaking the answer only for the record searched for;TruncateNoCheckpoint);--to-locatedwith a changed block at the located point (TruncateMismatch);official-partition-restart-resolve(the csnode: community bootstrap fallback (opt-in) and official-stop CI scenarios #188 scenario) ran on the temporary branchci/resolve-followups-partition(csnode: community bootstrap fallback (opt-in) and official-stop CI scenarios #188 + this PR,node_alt_ref=official). Every community node found the fork point exact and verified at #506 from the upper bound #1001, in 4 requests (about 30 s). One--resolve-forkper node, no--set-bc-top, no failed start after the cut: PASS at sequence 2000 with one chain. That branch'srun.shwaits forfork_point_statusbefore--resolve-fork; csnode: community bootstrap fallback (opt-in) and official-stop CI scenarios #188 can take that change.🤖 Generated with Claude Code